﻿namespace YaP.Library
{
    internal class ChannelListItem
    {
        private const int maxChannelNameLength = 64;
        private string channelField;
        private string nbUsersField;
        private string topicField;

        public ChannelListItem(string _ch, string _nb, string _to)
        {
            channelField = _ch;
            nbUsersField = _nb;
            topicField = _to;
        }

        public string Channel
        {
            get { return channelField; }
        }

        public override string ToString()
        {
            string lchan;
            if (channelField.Length > maxChannelNameLength)
            {
                lchan = channelField.Substring(0, maxChannelNameLength);
            }
            else
            {
                lchan = channelField;
                int currsize = channelField.Length;
                for (int i = currsize; i < maxChannelNameLength; i++)
                    lchan += " ";
            }

            return lchan + "\t" + nbUsersField + "\t" + topicField;
        }
    }
}